home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998…eptember: Technology Seed / September 98 ADC Seed CD.toast / FireWire 1.1 DR2 SDK / Interfaces / GenericDriverFamily.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-15  |  4.2 KB  |  170 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        GenericDriverFamily.h
  3.  
  4.     Contains:    Definitions and interfaces for Generic Driver family.
  5.  
  6.     Written by:    Erik Staats
  7.  
  8.     Copyright:    © 1996, 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.        <FW4>      1/4/98    EA        Remove "implement this" comment for
  13.                                     kGDFServiceIsLoadedUponDiscovery.
  14.        <FW3>    10/22/96    ES        Added driverRefNum to GDFDeviceEventData record.
  15.        <FW2>    10/21/96    ES        Filled in contains field.
  16.        <FW1>    10/21/96    ES        first checked in
  17.  
  18. */
  19.  
  20. #ifndef __GENERICDRIVERFAMILY__
  21. #define __GENERICDRIVERFAMILY__
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. #if PRAGMA_IMPORT_SUPPORTED
  28. #pragma import on
  29. #endif
  30.  
  31. #if PRAGMA_ALIGN_SUPPORTED
  32. #pragma options align=mac68k
  33. #endif
  34.  
  35. typedef KernelID                GDFDeviceEventRegistrationID;
  36. typedef KernelID                GDFDeviceID;
  37.  
  38. enum
  39. {
  40.     kInvalidGDFDeviceEventRegistrationID    = 0,
  41.     kInvalidGDFDeviceID            = 0
  42. };
  43.  
  44. enum
  45. {
  46.     kInvalidGDFEvent            = 0,
  47.     kGDFDeviceAddedEvent        = 1,
  48.     kGDFDeviceRemovedEvent        = 2
  49. };
  50.  
  51. typedef OSStatus    (GDFExpertEntryPoint) (void);
  52. typedef GDFExpertEntryPoint        *GDFExpertEntryPointPtr;
  53.  
  54. struct GDFDeviceEventDataStruct
  55. {
  56.     RegEntryID                    deviceRegEntryID;                        // Name Registry ID of device.
  57.     DriverRefNum                driverRefNum;                            // Driver ref num for device.
  58.     OSType                        serviceType;                            // Service type for device.
  59.     UInt32                        deviceEvent;                            // Type of event that occured.
  60.     GDFDeviceID                    gdfDeviceID;                            // GDF device ID of device.
  61.     GDFDeviceEventRegistrationID
  62.                                 gdfDeviceEventRegistrationID;            // Registration ID for this event.
  63.     UInt32                        eventHandlerData;                        // Data for use by handler.
  64. };
  65. typedef struct GDFDeviceEventDataStruct
  66.                                 GDFDeviceEventData,
  67.                                 *GDFDeviceEventDataPtr;
  68.  
  69. typedef OSStatus (GDFDeviceEventHandlerProc) (
  70.     GDFDeviceEventDataPtr        pGDFDeviceEventData);
  71. typedef GDFDeviceEventHandlerProc
  72.                                 *GDFDeviceEventHandlerProcPtr;
  73.  
  74.  
  75. ////////////////////////////////////////////////////////////////////////////////
  76. //
  77. // GDF service descriptor defs.
  78. //
  79.  
  80. enum
  81. {
  82.     kGDFServiceDescriptionSignature    = 'gdfs'
  83. };
  84.  
  85. enum
  86. {
  87.     kInitialGDFServiceDescriptor    = 0
  88. };
  89.  
  90. enum
  91. {
  92.     kGDFServiceIsLoadedUponDiscovery    = (1 << 0)                        // Auto-load GDFService when discovered.
  93. };
  94.  
  95. typedef UInt32                    GDFServiceDescVersion;
  96. typedef UInt32                    GDFServiceOSRunTimeOptions;
  97.  
  98. struct GDFServiceTypeStruct
  99. {
  100.     OSType                         gdfServiceName;                            // GDFService name.
  101.     NumVersion                     version;                                // GDFService version number.
  102.     OSType                         reserved;                                // Reserved area.
  103. };
  104. typedef struct GDFServiceTypeStruct
  105.                                 GDFServiceType,
  106.                                 *GDFServiceTypePtr;
  107.  
  108. struct GDFServiceOSRunTimeStruct
  109. {
  110.     GDFServiceOSRunTimeOptions     gdfServiceRuntime;                        // Options for OS runtime.
  111.     Str31                         gdfServiceName;                            // GDFService's name to the OS
  112.     UInt32                         gdfServiceDescReserved[8];                // Reserved area
  113. };
  114. typedef struct GDFServiceOSRunTimeStruct
  115.                                 GDFServiceOSRunTime,
  116.                                 *GDFServiceOSRunTimePtr;
  117.  
  118. struct GDFServiceDescriptionStruct
  119. {
  120.     OSType                         gdfServiceDescSignature;                // Signature field of this structure.
  121.     GDFServiceDescVersion         gdfServiceDescVersion;                    // Version of this data structure.
  122.     GDFServiceType                 gdfServiceType;                            // Type of driver.
  123.     GDFServiceOSRunTime         gdfServiceOSRuntime;                    // OS runtime requirements of GDFService.
  124. };
  125. typedef struct GDFServiceDescriptionStruct
  126.                                 GDFServiceDescription,
  127.                                 *GDFServiceDescriptionPtr;
  128.  
  129.  
  130. ////////////////////////////////////////////////////////////////////////////////
  131. //
  132. // Generic driver family services.
  133. //
  134.  
  135. OSStatus    GDFRegisterDeviceEventHandlerProc (
  136.     OSType                        serviceType,
  137.     UInt32                        numEvents,
  138.     UInt32                        *eventTable,
  139.     GDFDeviceEventHandlerProcPtr
  140.                                 gdfDeviceEventHandler,
  141.     UInt32                        eventHandlerData,
  142.     GDFDeviceEventRegistrationID
  143.                                 *pGDFDeviceEventRegistrationID);
  144.  
  145. OSStatus    GDFUnregisterDeviceEventHandler (
  146.     GDFDeviceEventRegistrationID
  147.                                 gdfDeviceEventRegistrationID);
  148.  
  149. OSStatus    GDFRegisterFSSpecExpert (
  150.     FSSpecPtr                    pExpertFSSpec);
  151.  
  152. OSStatus    GDFRegisterFSSpecResourceExpert (
  153.     FSSpecPtr                    pExpertFSSpec,
  154.     ResType                        expertResType,
  155.     short                        expertResID);
  156.  
  157. #if PRAGMA_ALIGN_SUPPORTED
  158. #pragma options align=reset
  159. #endif
  160.  
  161. #if PRAGMA_IMPORT_SUPPORTED
  162. #pragma import off
  163. #endif
  164.  
  165. #ifdef __cplusplus
  166. }
  167. #endif
  168.  
  169. #endif /* __GENERICDRIVERFAMILY__ */
  170.